using System;
using FluentNHibernate.Automapping;
using FluentNHibernate.Automapping.Alterations;
using MvcMall.Core.Domains;

namespace MvcMall.Data.NHibernateMaps
{
    public class UserAccountMap : IAutoMappingOverride<UserAccount>
    {
        public void Override(AutoMapping<UserAccount> mapping)
        {
            mapping.Id(m => m.Id).Column("UserId").GeneratedBy.Foreign("User");
            mapping.HasOne(m => m.User).Cascade.All().Constrained();
        }
    }
}